package com.md.model.request.authentication.users;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.md.annotation.validation.PasswordCheck;
import com.md.util.StringUtil;
import com.md.value.enums.SexEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;

/**
 * @author 刘骄阳
 * 2023-08-03 18:07
 */
@Data
@ApiModel("后台新增用户请求实体")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class AddUsersRequest {

  /**
   * 用户名
   */
  @ApiModelProperty("用户名")
  @NotBlank(message = "用户名不能为空!")
  private String name;

  /**
   * 密码
   */
  @ApiModelProperty("密码")
  @PasswordCheck(message = "密码必须为8-12位字符,请重新输入!")
  private String password;

  /**
   * 头像
   */
  @ApiModelProperty("头像")
  private String headIcon;

  /**
   * 性别(0: 未知;1:男;2:女)
   */
  @ApiModelProperty("性别(1:男;2:女)")
  private SexEnum sex;

  /**
   * 手机号
   */
  @ApiModelProperty("手机号")
  private String phone;

  /**
   * 角色Id
   */
  @ApiModelProperty("角色Id")
  @JsonFormat(shape = JsonFormat.Shape.STRING)
  private Long roleId;

  @Override
  public String toString() {
    return StringUtil.objectToJson(this);
  }

}
